import BaseModel from './baseModel'
import { Api } from '@ajax/api'
import { get } from '@ajax/axios'
import { CATCH_KEY_ME_DATA } from './cacheKey'

/**
 * 我的数据局换粗KEY
 */
const ME_DATA_CACHE_KEY = CATCH_KEY_ME_DATA

export default class MeModel extends BaseModel {

  // 顶部图片
  home_icon!: string
  // 简历链接
  home_jianli!: string
  // 首页标题
  home_title!:string
  // 关于我
  abouts!: string
  // 专业技能
  expertise!: string
  iosNum = 0
  nodeNum = 0
  webNum = 0
  xcxNum = 0
  javaNum = 0
  iosShow = ''
  webShow = ''
  nodeShow = ''
  xcxShow = ''
  javaShow = ''
  // 学习总结
  experience_show = ''
  // 工作经历说明
  works_show = ''

  /**
   * 加载全部数据
   * @param cache 是否缓存
   */
  static async loadData(cache: boolean = true) {
    return await this.cacheData(() => {
      return get(Api.me.detail)
    }, ME_DATA_CACHE_KEY, cache)
  }
}
